<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>生产派工单审核</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../css/public.css" media="all">

    <style>
        .layui-form-label {
            color: #000000;
        }

        .layui-input {
            width: 200px;
        }

        .remark {
            width: 524px;
        }

        .form-padding {
            padding-top: 20px;
        }

        .button-info {
            position: absolute;
            left: 304px;
            bottom: 35px;
        }

        .make-erver {
            margin-top: -4px;
        }
    </style>
</head>
<body>

<div class="layuimini-container">
    <div class="layuimini-main">
        <table class="layui-hide" id="test" lay-filter="test"></table>

    </div>
</div>






<script src="../../../lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="../../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="../../../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="../../../lib/jq-module/jquery.particleground.min.js" charset="utf-8"></script>
<script src="../../../lib/common/jquery.cookie.min.js" charset="utf-8"></script>
<script src="../../../lib/common/common.js" charset="utf-8"></script>


<script type="text/html" id="toolbarDemo2">
</script>

<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-normal make-erver"  lay-event="add">审核</button>
    </div>
</script>




<script>


    let apiUrl = "http://localhost:8003/";

    layui.use(['table', 'layer','laydate'], function () {
        let table = layui.table;
        let layer = layui.layer;
        let laydate = layui.laydate;

        //常规用法
        laydate.render({
            elem: '#test1'
        });


        table.render({
            elem: '#test'
            , url: apiUrl+'production/getFindByProduction_generate'
            , page: true
            , toolbar: '#toolbarDemo2' //开启头部工具栏，并为其绑定左侧模板
            , defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                title: '提示'
                , layEvent: 'LAYTABLE_TIPS'
                , icon: 'layui-icon-tips'
            }]
            , cols: [[
                {type: 'checkbox'}
                , {field: 'id', align: 'center', title: 'id',hide:true}
                , {field: 'schedule_id', align: 'center', title: '生产派工单编号'}
                , {field: 'product_id', title: '产品编号'}
                , {field: 'product_name', title: '产品名称'}
                , {field: 'quantity', title: '数量'}
                , {field: 'qutbound_order_id', title: '出库单编号'}
                , {field: 'review_time', title: '登记时间'}
                , {field: 'checked_audit', title: '审核状态'}
                , {title: '操作', templet: '#toolbarDemo', fixed: "right", align: "center"}
            ]]
        });

      /*  //监听行工具事件
        table.on('tool(test)', function(obj){
            var data = obj.data;
            //console.log(obj)
            if(obj.event === 'add'){
                layer.confirm('确定审核吗', function(index){
                    obj.del();
                    layer.close(index);
                });
            } else if(obj.event === 'edit'){
                layer.prompt({
                    formType: 2
                    ,value: data.email
                }, function(value, index){
                    obj.update({
                        email: value
                    });
                    layer.close(index);
                });
            }
        });*/


        //监听工具条
        table.on('tool(test)', function (obj) {
            var data = obj.data;
            console.log(data.id);
            if(obj.event === 'add'){
                layer.confirm('确定审核吗', function(index){
                    obj.del();
                    layer.close(index);
                    $.post(apiUrl+'production/updatechecked_audit',data,function (res) {
                        layer.msg(res);
                        if (res.code == 200) {
                            tableIns.reload();
                        }
                    })
                    return false;
                });
            }

        });




    });

</script>


</body>
</html>